/**
 * Software License, Version 1.0
 * 
 * Copyright 2003 The Trustees of Indiana University.  All rights reserved.
 * 
 *
 *Redistribution and use in source and binary forms, with or without 
 *modification, are permitted provided that the following conditions are met:
 *
 *1) All redistributions of source code must retain the above copyright notice,
 * the list of authors in the original source code, this list of conditions and
 * the disclaimer listed in this license;
 *2) All redistributions in binary form must reproduce the above copyright 
 * notice, this list of conditions and the disclaimer listed in this license in
 * the documentation and/or other materials provided with the distribution;
 *3) Any documentation included with all redistributions must include the 
 * following acknowledgement:
 *
 *"This product includes software developed by the Community Grids Lab. For 
 * further information contact the Community Grids Lab at 
 * http://communitygrids.iu.edu/."
 *
 * Alternatively, this acknowledgement may appear in the software itself, and 
 * wherever such third-party acknowledgments normally appear.
 * 
 *4) The name Indiana University or Community Grids Lab or NaradaBrokering, 
 * shall not be used to endorse or promote products derived from this software 
 * without prior written permission from Indiana University.  For written 
 * permission, please contact the Advanced Research and Technology Institute 
 * ("ARTI") at 351 West 10th Street, Indianapolis, Indiana 46202.
 *5) Products derived from this software may not be called NaradaBrokering, 
 * nor may Indiana University or Community Grids Lab or NaradaBrokering appear
 * in their name, without prior written permission of ARTI.
 * 
 *
 * Indiana University provides no reassurances that the source code provided 
 * does not infringe the patent or any other intellectual property rights of 
 * any other entity.  Indiana University disclaims any liability to any 
 * recipient for claims brought by any other entity based on infringement of 
 * intellectual property rights or otherwise.  
 *
 *LICENSEE UNDERSTANDS THAT SOFTWARE IS PROVIDED "AS IS" FOR WHICH NO 
 *WARRANTIES AS TO CAPABILITIES OR ACCURACY ARE MADE. INDIANA UNIVERSITY GIVES
 *NO WARRANTIES AND MAKES NO REPRESENTATION THAT SOFTWARE IS FREE OF 
 *INFRINGEMENT OF THIRD PARTY PATENT, COPYRIGHT, OR OTHER PROPRIETARY RIGHTS. 
 *INDIANA UNIVERSITY MAKES NO WARRANTIES THAT SOFTWARE IS FREE FROM "BUGS", 
 *"VIRUSES", "TROJAN HORSES", "TRAP DOORS", "WORMS", OR OTHER HARMFUL CODE.  
 *LICENSEE ASSUMES THE ENTIRE RISK AS TO THE PERFORMANCE OF SOFTWARE AND/OR 
 *ASSOCIATED MATERIALS, AND TO THE PERFORMANCE AND VALIDITY OF INFORMATION 
 *GENERATED USING SOFTWARE.
 */
package cgl.narada.wsinfra.benchmark;


/**This is a class which maintains information regarding the various operations
   that are benchmarked within this package. Each operation has a static value
   and string associated with it, which are used inthe timing operations. 

   @author Shrideep Pallickara
   $Date: 2005/07/29 22:41:29 $
   $Revision: 1.4 $
*/


public class BenchmarkConstants {
  
  public static final int CREATE_ENVELOPE = 1;
  public static final String CREATE_ENVELOPE_STRING = "CreateEnvelopeDocument";

  public static final int CREATE_SOAPMESSAGE = 2;
  public static final String CREATE_SOAPMESSAGE_STRING = "CreateSOAPMessage";
  
  public static final int CONVERT_ENVELOPE_DOCUMENT = 3;
  public static final String CONVERT_ENVELOPE_DOCUMENT_STRING = "ConvertEnvelopeDocument";

  public static final int CONVERT_SOAP_MESSAGE = 4;
  public static final String CONVERT_SOAP_MESSAGE_STRING = "ConvertSOAPMessage";
  
  public static final int CREATE_EPR = 5;
  public static final String CREATE_EPR_STRING = "CreateEpr";

  
  public static final int CREATE_EPR_WITH_REF_PROPS = 6;
  public static final String CREATE_EPR_WITH_REF_PROPS_STRING = "CreateEPRWithReferenceProperties";


  public static final int CREATE_EPR_ENVELOPE = 7;
  public static final String CREATE_EPR_ENVELOPE_STRING = "CreateEprEnvelope";

  public static final int CREATE_EPR_ENVELOPE_WITH_MOST_WSA_FIELDS = 8;
  private static final String CREATE_EPR_ENVELOPE_WITH_MOST_WSA_FIELDS_STRING =
  "CreateEprEnvelopeWithMostWsaFields()";


  public static final int PARSE_WSA_HEADERS = 9;
  public static final String PARSE_WSA_HEADERS_STRING = "ParseWsaHeaders";
  

  public static final int CREATE_WSRM_FAULT = 10;
  public static final String CREATE_WSRM_FAULT_STRING = "CreateWsrmFault";

  public static final int CREATE_WSRM_CREATE_SEQUENCE = 11;
  public static final String CREATE_WSRM_CREATE_SEQUENCE_STRING = "CreateWsrmSequenceRequest";

  public static final int CREATE_WSRM_CREATE_SEQUENCE_RESPONSE = 12;
  public static final String CREATE_WSRM_CREATE_SEQUENCE_RESPONSE_STRING = "CreateWsrmSequenceResponse";

  public static final int CREATE_WSRM_SEQUENCE_DOCUMENT = 13;
  public static final String CREATE_WSRM_SEQUENCE_DOCUMENT_STRING = "CreateWsrmSequenceDocument";

  public static final int ADD_WSRM_SEQUENCE_DOCUMENT = 14;
  public static final String ADD_WSRM_SEQUENCE_DOCUMENT_STRING = "AddWsrmSequenceDocument";
  
  public static final int CREATE_SEQUENCE_ACKNOWLEDGEMENT = 15;
  public static final String CREATE_SEQUENCE_ACKNOWLEDGEMENT_STRING = "CreateSequenceAcknowledgement";

  public static final int CREATE_TERMINATE_SEQUENCE = 16;
  public static final String CREATE_TERMINATE_SEQUENCE_STRING = "CreateTerminateSequence";
  
  
  public static final int CREATE_SUBSCRIBE_REQUEST = 30;
  public static final String CREATE_SUBSCRIBE_REQUEST_STRING = "CreateSubscribeRequest";
  
  public static final int CREATE_SUBSCRIBE_RESPONSE = 31;
  public static final String CREATE_SUBSCRIBE_RESPONSE_STRING = "CreateSubscribeResponse";
  
  public static final int CREATE_RENEW_REQUEST = 32;
  public static final String CREATE_RENEW_REQUEST_STRING = "CreateRenewRequest";
  
  public static final int CREATE_RENEW_RESPONSE = 33;
  public static final String CREATE_RENEW_RESPONSE_STRING = "CreateRenewResponse";
  
  public static final int CREATE_GET_STATUS_REQUEST = 34;
  public static final String CREATE_GET_STATUS_REQUEST_STRING = "CreateGetStatusRequest";
  
  public static final int CREATE_GET_STATUS_RESPONSE = 35;
  public static final String CREATE_GET_STATUS_RESPONSE_STRING = "CreateGetStatusResponse";
  
  public static final int CREATE_UNSUBSCRIBE_REQUEST = 36;
  public static final String CREATE_UNSUBSCRIBE_REQUEST_STRING = "CreateUnsubscribeRequest"; 
  
  public static final int CREATE_UNSUBSCRIBE_RESPONSE = 37;
  public static final String CREATE_UNSUBSCRIBE_RESPONSE_STRING = "CreateUnsubscribeResponse";
  
  public static final int CREATE_SUBSCRIPTION_END = 38;
  public static final String CREATE_SUBSCRIPTION_END_STRING = "CreateSubscriptionEnd";
  
  
  public static final int PERFORM_XPATH_MATCHING = 39;
  public static final String PERFORM_XPATH_MATCHING_STRING = "PerformXPATH-Matching";
	  
  public static final int PERFORM_TOPIC_MATCHING = 40;
  public static final String PERFORM_TOPIC_MATCHING_STRING = "PerformTopic-Matching";  
  
  
  public static final int PERFORM_REGEX_MATCHING = 41;
  public static final String PERFORM_REGEX_MATCHING_STRING = "PerformRegEx-Matching";
  
  public static final int PERFORM_XQUERY_MATCHING = 42;
  public static final String PERFORM_XQUERY_MATCHING_STRING = "PerformXQuery-Matching";
  
  
  private static final BenchmarkConstants instance= new BenchmarkConstants();
  
  private BenchmarkConstants() {
  }
  

  public static BenchmarkConstants getInstance() {
    return instance;    
  }

  public String getOperationName(int operation) {
    String operationName = "UNKNOWN OPERATION";
    
    if (operation == CREATE_ENVELOPE) {
      return CREATE_ENVELOPE_STRING;
    }

    if (operation == CREATE_SOAPMESSAGE) {
      return CREATE_SOAPMESSAGE_STRING;
    }

    if (operation == CONVERT_ENVELOPE_DOCUMENT) {
      return CONVERT_ENVELOPE_DOCUMENT_STRING;
    }
   
    if (operation == CONVERT_SOAP_MESSAGE) {
      return CONVERT_SOAP_MESSAGE_STRING;
    }

    if (operation == CREATE_EPR) {
      return CREATE_EPR_STRING;
    }

    if (operation == CREATE_EPR_WITH_REF_PROPS) {
      return CREATE_EPR_WITH_REF_PROPS_STRING;
    }

    if (operation == CREATE_EPR_ENVELOPE) {
      return CREATE_EPR_ENVELOPE_STRING;
    }

    if (operation == CREATE_EPR_ENVELOPE_WITH_MOST_WSA_FIELDS) {
      return CREATE_EPR_ENVELOPE_WITH_MOST_WSA_FIELDS_STRING;
    }
    
    if (operation == PARSE_WSA_HEADERS) {
      return PARSE_WSA_HEADERS_STRING;
    }

    if (operation == CREATE_WSRM_FAULT) {
      return CREATE_WSRM_FAULT_STRING;
    }

    if (operation == CREATE_WSRM_CREATE_SEQUENCE) {
      return CREATE_WSRM_CREATE_SEQUENCE_STRING;
    }

    if (operation == CREATE_WSRM_CREATE_SEQUENCE_RESPONSE ) {
      return CREATE_WSRM_CREATE_SEQUENCE_RESPONSE_STRING;
    }
 
    if (operation == CREATE_WSRM_SEQUENCE_DOCUMENT) {
      return CREATE_WSRM_SEQUENCE_DOCUMENT_STRING;
    }
    
    if (operation == ADD_WSRM_SEQUENCE_DOCUMENT) {
      return ADD_WSRM_SEQUENCE_DOCUMENT_STRING;
    }

    if (operation == CREATE_SEQUENCE_ACKNOWLEDGEMENT) {
      return CREATE_SEQUENCE_ACKNOWLEDGEMENT_STRING;
    }

    if (operation == CREATE_TERMINATE_SEQUENCE) {
      return CREATE_TERMINATE_SEQUENCE_STRING;
    }

    if (operation == CREATE_SUBSCRIBE_REQUEST)  {
       return CREATE_SUBSCRIBE_REQUEST_STRING;
     }
    

    if (operation == CREATE_SUBSCRIBE_RESPONSE) {
   	 return CREATE_SUBSCRIBE_RESPONSE_STRING;
    }
    
    if (operation == CREATE_RENEW_REQUEST) {
   	 return CREATE_RENEW_REQUEST_STRING;
    }
    
    if (operation == CREATE_RENEW_RESPONSE) {
   	 return CREATE_RENEW_RESPONSE_STRING;
    }
    
    if (operation == CREATE_GET_STATUS_REQUEST) {
   	 return CREATE_GET_STATUS_REQUEST_STRING;
    }
    
    if (operation == CREATE_GET_STATUS_RESPONSE) {
   	 return CREATE_GET_STATUS_RESPONSE_STRING;
    }
    
    if (operation == CREATE_UNSUBSCRIBE_REQUEST) {
   	 return CREATE_UNSUBSCRIBE_REQUEST_STRING;
    }
    
    if (operation == CREATE_UNSUBSCRIBE_RESPONSE) {
   	 return CREATE_UNSUBSCRIBE_RESPONSE_STRING;
    }
    
    if (operation == CREATE_SUBSCRIPTION_END) {
   	 return CREATE_SUBSCRIPTION_END_STRING;
    }
    
    if (operation == PERFORM_XPATH_MATCHING) {
   	return PERFORM_XPATH_MATCHING_STRING; 
    }
    
    if (operation == PERFORM_TOPIC_MATCHING) {
   	 return PERFORM_TOPIC_MATCHING_STRING;
    }
    
    if (operation == PERFORM_REGEX_MATCHING) {
   	 return PERFORM_REGEX_MATCHING_STRING;
    }
    
    if (operation == PERFORM_XQUERY_MATCHING) {
   	 return PERFORM_XQUERY_MATCHING_STRING;
    }
    
     return operationName;
  }

  
  public boolean isValidOperation(int operation) {
    if (operation > 0 && operation <= 16) {
      return true;
    }
    
    /** These relate to WSE */
    if (operation >= 30 && operation <= 42) {
   	 return true;
    }
    
    return false;
  }

}
